package com.itheima.sh.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.sh.pojo.IpCount;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

public interface DockerMapper extends BaseMapper<IpCount> {

    @Update("update t_count set count=#{count} where Ip =#{ip}")
     void updateByIp(@Param("count") int count, @Param("ip") String ip);

    @Select("select * from t_count where Ip=#{ip}")
    IpCount findByIp(@Param("ip") String ip);

    @Insert("insert into t_count values(null,#{ip},#{count})")
    void insertByIp(@Param("ip") String ip, @Param("count") int count);

    @Select("select count from t_count where Ip=#{ip}")
    int getCount(@Param("ip") String ip);
}
